Solving for rectangles in a net