diff --git a/geometry.go b/geometry.go
index e49471268c1c287cb864c67e0b234f9ecaa632c5..fc0f9be4ffccfd87d4c68ee80d5163b797646fed 100644
--- a/geometry.go
+++ b/geometry.go
@@ -272,6 +272,16 @@ func (r Rect) Contains(u Vec) bool {
 	return r.Min.X() <= u.X() && u.X() <= r.Max.X() && r.Min.Y() <= u.Y() && u.Y() <= r.Max.Y()
 }
 
+// Union returns a minimal Rect which covers both r and s. Rects r and s should be normalized.
+func (r Rect) Union(s Rect) Rect {
+	return R(
+		math.Min(r.Min.X(), s.Min.X()),
+		math.Min(r.Min.Y(), s.Min.Y()),
+		math.Max(r.Max.X(), s.Max.X()),
+		math.Max(r.Max.Y(), s.Max.Y()),
+	)
+}
+
 // Matrix is a 3x3 transformation matrix that can be used for all kinds of spacial transforms, such
 // as movement, scaling and rotations.
 //