  We investigate the quantum mechanics of a single particle constrained to move
along an arbitrary smooth reference curve by a confinement that is allowed to
vary along the waveguide. The Schr\"odinger equation is evaluated in the
adapted coordinate frame and a transverse mode decomposition is performed,
taking into account both curvature and torsion effects and the possibility of a
cross-section potential that changes along the curve in an arbitrary way. We
discuss the adiabatic structure of the problem, and examine nonadiabatic
couplings that arise due to the curved geometry, the varying transverse profile
and their interplay. The exact multi-mode matrix Hamiltonian is taken as the
natural starting point for few-mode approximations. Such approximate equations
are provided, and it is worked out how these recover known results for twisting
waveguides and can be applied to other types of waveguide designs. The quantum
waveguide Hamiltonian is recast into a form that clearly illustrates how it
generalizes the Born-Oppenheimer Hamiltonian encountered in molecular physics.
In analogy to the latter, we explore the local gauge structure inherent to the
quantum waveguide problem and suggest the usefulness of diabatic states, giving
an explicit construction of the adiabatic-to-diabatic basis transformation.
