A theory for quantum accelerator modes in atom optics