How to limit a rigitbody to an area

I have a game object (say a cube) with a rigitbody, so it can be pushed around by the player.
This game object is the child of another Cube (lets call it field). I want to limit the inner object so it cannot be pushed outside of the field.

My problem arises when the field is rotated compared with the global axis. At this point I cannot simply use Mathf.Clamp, since the global x and z coordinates do not have a constant upper/lower boundary (the boundaries for x depend on the current z and vice versa).
I tried clamping transform.localposition but this has rather odd effects and doesn’t seem to work.

I could use trig to calculate the boundaries in regards to the current position on the other axis ( the boundaries for x =[field.position.x -(tan(a) * (cube.position.z - field.position.z)),field.position.x + (tan(a) * (cube.position.z - field.position.z))]) but that does seem like a sort of messy workaround.

Is there a relatively simple way to restrict the cubes movement to inside the field?

Put up blocks around the area. Turn off their renderers. Adjust the collision layer parameters so that only the block is affected by the collision.