static LL makeGridOfRects2(int w, int h, int rw, int rh) { ret makeGridOfRects2(Rect(0, 0, w, h), rw, rh); } static LL makeGridOfRects2(Rect r, int rw, int rh) { new LL l; int w = r.w-mod(r.w, rw); int h = r.h-mod(r.h, rh); for (int y = r.y; y < h; y += rh) { new L line; for (int x = r.x; x < w; x += rw) line.add(Rect(x, y, rw, rh)); l.add(line); } ret l; }