This posting explains the meaning of a polar decomposition, and it gives two numerical methods for computing it.
Below is shown simple shear of a unit square. The inscribed circle and the lines from corner to corner should be regarded as painted on the material, so they flow with deformation. The green and red dashed lines show the principal directions of stretch, which are aligned with the major axes of the deformed ellipse and hence move relative to the material as the deformation proceeds. In the deformed state (far right), the red and green dashed lines are defined to be aligned with the major axes of the deformed ellipse (far right). The red and green dashed lines in the other states show the material points covered by those green and red lines in the deformed state.