Quantum‐Mechanical Treatment of Inelastic Collisions. I. General Theory and Application to Nonreactive Collisions