Using small sections from any loop we get:
$\tau = I \Delta r \times(\Delta l \times B) $
Now use rule for triple cross product:
$A \times B \times C = B(A.C) - C(A.B)$ //back cap
Now it's clear that you are looking at projections and because it is a planar loop, so its projections can be modeled as a rectangle.
[![enter image description here][1]][1]
As you know, take more of them and you won't worry about their width as the force will pass through the line of rotation giving zero torque. [1]: https://i.sstatic.net/qzatm.png