Multi-Instance Causal Representation Learning for Instance Label Prediction and Out-of-Distribution Generalization