How ecosystems respond to environmental perturbations is a fundamental question in ecology, made especially challenging due to the strong coupling between species and their environment. Here, we introduce a theoretical framework for calculating the steady-state response of ecosystems to environmental perturbations in generalized consumer-resource. Our construction is applicable to a wide class of systems, including models with non-reciprocal interactions, cross-feeding, and non-linear growth/consumption rates. Within our framework, all ecological variables are embedded into four distinct vector spaces and ecological interactions are represented by geometric transformations between these spaces. We show that near a steady state, such geometric transformations directly map environmental perturbations - in resource availability and mortality rates - to shifts in niche structure. We illustrate these ideas in a variety of settings including a minimal model for pH-induced toxicity in bacterial denitrification. We end by discussing the biological implications of our framework. In particular, we show that it is extremely difficult to distinguish cooperative and competitive interactions by measuring species' responses to external perturbations.