This is a mathematics problem with the application in computer science. Basically I have a rotated 2D box (black) and I need to find the closest point (red) on its' bounds towards a point (green) in 2D Space.
The box is defined by center (x/y) size (x,y) and rotation (y euler angles). Approximations which are performance efficient are welcome as well.


Ok so I have found the best way is to treat the box as 4 linear functions and calculate the closest distance between the point and each line (orthogonal function) and then take the closest one.