splitting into rectangles