Rule Extrapolation in Language Modeling: A Study of Compositional Generalization on OOD Prompts