Returned rectangles not matching extracted rectangles problem solved.