Quantum theory of photodissociation of polyatomic molecules: Application to HCN