Easy way out is to manually de-rail the chain. Do it at the Pedal-crank (front)
That will generate enough slack in the chain facilitating rear tyre removal.
It will fail to shift or worse keep slipping. Make sure you keep the chain on the smallest cog (on the rear wheel) so it will be have more slack and will be easier to remove.
Oh yeah keep the bike inverted (yes the wheel skywards) No I kid you not.. Its very easy to keep the tyres up on an MTB with the seat and handle bar keeping the bike level.