Magnetic quantum ratchet effect in graphene