Towards Context-Aware Domain Generalization: Representing Environments with Permutation-Invariant Networks