I’m struggling to articulate this question, so please bear with me.

Imagine a skateboard. When rolling down the road, the deck of the skateboard rotated so as to align with the road, albeit a few inches higher. You might also say, it has no rotation.

When he skateboard is on a ramp at a 45º incline, the deck is rotated to align with the ramp. Perhaps the rotation along the x axis is 45º.

But, if the skateboard is approaching the ramp at an angle, the rotation of the board is aligned with the ramp, but the decks rotation along each axis will not be 45º. So one way of phrasing this question might be, how do I calculate the rotation of the deck.

Here’s an attempt at visualising the problem. Take the points at the top of each purple pole.

Now imagine I want to place a the green box in such a way that it appears to align naturally with each of those four points.

.If I know those four points, how would I calculate the rotation for the green box?