Normalize OCR boxes into the parser’s upright frame
Spatial OCR rules are only meaningful after every box is transformed into one upright document frame. If preprocessing returns boxes in original-image pixels after a quarter-turn correction, sorting raw coordinates can invert header/body order and corrupt row association. Carry the coordinate-frame name, rotation, and original dimensions with the OCR result; inverse-map all four box corners; normalize after rotation; and fail closed on malformed or out-of-bounds geometry. Test 0/90/180/270 degrees by asserting semantic row order, not only bounds.
Applies when: A document OCR pipeline rotates pixels but preserves geometry in the source-image frame. Keywords: PaddleOCR geometry rotation coordinate frame polygons document layout parser