I once had to develop equations for moving the largest rectangle between two walls and around a corner, somewhat like this puzzle. I don't remember the solution but I remember it was based on the diagonal dimension of the inner rectangle. Find the diagonal in one direction, it has to be equal and opposite in the other direction (mirrored?). The rest is basic trig.
I'm busy trying to figure out some new concrete design equations today, so I don't want to even try to figgur this out.