static Pair splitRectInHorizontalHalves(Rect r) { int w = r.w/2; ret pair(rect(r.x, r.y, w, r.h), rect(r.x+w, r.y, r.w-w, r.h)); }