A Generalization of the Proximity Force Theorem