adjustRect :: (Real a) => a -> a -> a -> a -> Rect a -> Rect a
adjustRect x1 y1 x2 y2 (Rect x y w h) =
  Rect (x + x1) (y + y1) (max 0 $ w - x2 - x1) (max 0 $ h - y2 - y1)
adjustRect :: (Real a) => a -> a -> a -> a -> Rect a -> Rect a
adjustRect x1 y1 x2 y2 (Rect x y w h) =
  Rect (x + x1) (y + y1) (max 0 $ w - x2 - x1) (max 0 $ h - y2 - y1)
adjustRect x1 y1 x2 y2 (Rect x y w h) =
  Rect (x + x1) (y + y1) (max 0 $ w - x2 - x1) (max 0 $ h - y2 - y1)