The idea
transform: rotate(angle) turns the element around its transform-origin (the centre, by default). A rotated rectangle's axis-aligned bounding box is *larger* than the rectangle itself — that is the box the engine measures. Rotate the box 45°.
Resizing and repositioning are off-limits: the target's bigger bounding box must come from rotation, not from a wider box.