Counterfactuals uncover the modular structure of deep generative models