I noticed this angular difference while reading these Quora and Reddit posts about why sedans don't have rear wipers, as the aerodynamic reason fails to remove precipitation as efficaciously as wipersn.
Wouldn't a 45° rear window be better for SUVs, to lessen road debris spattering the rear window?
The reason for the question in the title (why vertical?) is that car has a maximum possible length if you want it to be maneuverable in tight spaces. For example, my Toyota RAV4 hybrid is approximately 4.6 meters long. Quite long, in my opinion. Compared to the Toyota Yaris I used to have, it's much less maneuverable.
If the car was longer, say 5.0 meters long (like Tesla Model X), you couldn't maneuver the car through very tight corners. One of the reasons why I don't have a Tesla Model X (another being its width, third being its price).
Now, Tesla Model X doesn't have a vertical rear window, the window being more like 45 degrees. My Toyota RAV4 hybrid has a vertical rear window.
This means that if you want to transport large objects, a Tesla Model X with its 5.0 meter length is probably approximately as useful as my 4.6 meters long Toyota RAV4 hybrid. Same indoor dimensions at the roof level, much different external dimensions.
Now, would a 45 degree rear window be better? I would say not better, because it would make the car too long externally if it has any useful large object carrying capacity, or make the car's carrying capacity too limited if the external dimensions are sensible.
Am I alone in this opinion? You know, some people actually buy Tesla Model X. I even know somebody who has a Tesla Model X! Personally, I'm happy with my vertical rear window and wouldn't change to a 45 degree window. I'll buy an electric or plug-in-hybrid SUV the day when you can purchase one that has small enough external dimensions, large enough internal dimensions (necessitating a vertical rear window), sensible enough price and made by a reputable manufacturer I can trust.
There are basically two options to reduce air resistance at the rear of the car to a minimum.
One is to make the rear flat and vertical. That way, the air flowing over the car doesn't create any turbulence until it has "passed" the rear of the car.
The other way is to make body into an airfoil shape by bringing the roof level down smoothly and raising the floor level at the rear, so the air flow does not separate from the car bodywork. That has been carried to its logical conclusion in experimental solar powered cars (image source: Wikipedia)
Introducing a "backward facing step" by having a flat roof, a vertical rear window, and a flat top to the trunk is pretty much the worst of all worlds, aerodynamically. Hence the rear window is sloped to get closer to an airfoil shape.
In practice, body designs are a compromise between aerodynamic efficiency, functionality and aesthetics - for example a 30-ton truck with a flat rear panel is both functional (to maximize the volume of the cargo space) and aerodynamic, but not pretty!