The idea
Everything at once. Box A needs a chained translate and rotate; box B needs a translate and a scale that pivots on its top-left corner. Match both bounding boxes — no resizing, no margins, just transforms.
Resizing and repositioning are off-limits, and transform-origin is required: box B's scale must pivot on a corner.