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