Copy crop box with rotation?

Is there a way to copy the rotation of the crop box from a view? I have this script and it works great but lately the model we receive have the views rotated and no scope box’s.