Measurement and interpretation of magnetic shear in solar active regions