Step 1: Plan:
Work with vectors. Choose axes, write the force on each arm as $I\vec{l}\times\vec{B}$, then add the torques $\vec{r}\times\vec{F}$ about the centre of the loop.
Step 2: Choose axes and describe the diagram:
Let $\vec{B} = B\hat{k}$. Take a rectangular loop with sides $a$ (along $\pm\hat{j}$) and $b$. The current goes along $+\hat{j}$ in side 1, then along side 2 of length $b$, then along $-\hat{j}$ in side 3, then back along side 4.
Let the unit normal be $\hat{n} = \sin\theta\,\hat{i} + \cos\theta\,\hat{k}$, so $\vec{A} = A\hat{n}$ with $A = ab$ and angle $\theta$ between $\vec{A}$ and $\vec{B}$. The side of length $b$ then has the direction $\hat{u} = -\cos\theta\,\hat{i} + \sin\theta\,\hat{k}$ and $\hat{j}\times\hat{u} = \hat{n}$, which matches the right-hand rule.
Sketch: the loop is drawn tilted by $\theta$, with $\vec{B}$ drawn vertically and $\hat{n}$ drawn at angle $\theta$ to it.
Step 3: Forces on the four sides:
Side 1 (current $+a\hat{j}$): $\vec{F}_1 = I(a\hat{j})\times B\hat{k} = IaB\,\hat{i}$.
Side 3 (current $-a\hat{j}$): $\vec{F}_3 = -IaB\,\hat{i}$.
Sides 2 and 4 carry currents $\pm b\hat{u}$, which give forces $\pm IbB\cos\theta\,\hat{j}$. These two forces lie along the same line, so their torque is zero.
The net force is zero.
Step 4: Torque about the centre:
Relative to the centre, side 1 is at $-\tfrac{b}{2}\hat{u}$ and side 3 is at $+\tfrac{b}{2}\hat{u}$.
\[ \vec{\tau} = \left(-\tfrac{b}{2}\hat{u}\right)\times(IaB\,\hat{i}) + \left(\tfrac{b}{2}\hat{u}\right)\times(-IaB\,\hat{i}) = -IabB\,(\hat{u}\times\hat{i}) \]
Now $\hat{u}\times\hat{i} = \sin\theta\,(\hat{k}\times\hat{i}) = \sin\theta\,\hat{j}$. So
\[ \vec{\tau} = -IabB\sin\theta\,\hat{j} \]
Step 5: Write it as a cross product:
Compute $I\vec{A}\times\vec{B} = I\,ab\,(\sin\theta\,\hat{i} + \cos\theta\,\hat{k})\times B\hat{k} = IabB\sin\theta\,(\hat{i}\times\hat{k}) = -IabB\sin\theta\,\hat{j}$.
This is the same as the torque found above. So
\[ \vec{\tau} = I\,\vec{A}\times\vec{B} = \vec{m}\times\vec{B} \]
Its magnitude is $IAB\sin\theta$.
Final Answer:
The torque on the loop is $\vec{\tau} = I\vec{A}\times\vec{B} = \vec{m}\times\vec{B}$.
\[ \boxed{\vec{\tau} = I\,\vec{A}\times\vec{B}} \]