Decomposition of binary matrix into non overlapping rectangles