Varieties for modules, and injective resolutions of cohomology