Quantum Dynamical Aspects of Rotationally and Vibrationally Mediated Photochemistry in Matrices and at Surfaces: HCl/DCl in Ar, and NH3/ND3 at Cu(111)