Relativistic Magnetohydrodynamics with Application to Gamma-Ray Burst Outflows. I. Theory and Semianalytic Trans-Alfvénic Solutions