  Sr2IrO4 is a prototype of the class of Mott insulators in the strong
spin-orbit interaction (SOI) limit described by a $J_{\mathrm{eff}}=1/2$ ground
state. In Sr2IrO4, the strong SOI is predicted to manifest itself in the
slaving of the canting of the magnetic moments to the correlated rotation by
11.8(1)$^{\circ}$ of the oxygen octahedra that characterizes its distorted
layered perovskite structure. Using X-ray resonant scattering at the Ir $L_3$
edge we have measured accurately the intensities of Bragg peaks arising from
different components of the magnetic structure. From a careful comparison of
integrated intensities of peaks due to basal-plane antiferromagnetism, with
those due to b-axis ferromagnetism, we deduce a canting of the magnetic moments
of 12.2(8)$^{\circ}$. We thus confirm that in Sr2IrO4 the magnetic moments
rigidly follow the rotation of the oxygen octahedra, indicating that, even in
the presence of significant non-cubic structural distortions, it is a close
realization of the $J_{\mathrm{eff}}=1/2$ state
