I have faced a problem, that I need to calculate a shortest distance between two rectangles, which are on a different angles.

Known parameters: length, width, angle and coordinate of center point of each rectangular.
I have faced a problem, that I need to calculate a shortest distance between two rectangles, which are on a different angles.

Known parameters: length, width, angle and coordinate of center point of each rectangular.
On
The typical method is to rotate the coordinate system to one box and check the vertices of the other. This transforms the problem to this:

NOTE: See https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection and links theirin. In separating axis theorem there is a way to find minimum distance which is equivalent to the above.
You can easily deduce that the shortest distance will be attained for the vertices of one of the rectangles (but possibly the sides of the other). Then you really have to compare the distances of $8$ given points from $8$ given lines, which shouldn't be that bad...