Artificial intelligent assistant

The smallest quadrangle inscribed in a rectangle I'm supposed to find a quadrangle of the smallest perimeter possible inscribed in a rectangle. The inscribed quadrangle has each of its four vertices on another side of the rectangle. Let's call the rectangle ABCD and let the shorter side be $a$ and the larger $b$. Let's call the quadrangle $KLMN$. So for example $K$ lies on $AB$, $L$ on $BC$, $M$ on $CD$, $N$ on $AD$. I think that the sides of $KLMN$ would be the shortest of its diagonals intersected at the right angle, because then by the law of cosines, we have $KL^2 + LM^2= KM^2 + 2 KL \cdot LM \cdot \cos \angle KLM$, and $\cos \angle KLM \le 0$ if $\angle KLM \ge 90 ^{\circ}$ and $KM$ is the shortest if it is parallel = equal to the proper side of the rectangle. Could you tell me if I'm right or correct me if I'm wrong? Thank you.

Unflod your rectangle to make a grid and place K, L, M and N on it. You goal is to shorten the distance $KL+LM+MN+NK'$.

You need to align $KLMNK'$ to reach the minimal distance for $KK'$. That's $2.AC$

Here is a picture of a non-optimal situation. If it were optimal, then $KLM'N'K'$ would be a straight line.

!Illustration

Here is a picure of an optimal situation:

!enter image description here

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy e31e162f652e9e300a00f05e7a635bfe