Local Invertibility in Sobolev Spaces with Applications to Nematic Elastomers and Magnetoelasticity