The gist of it is that the Z value is obtained by doing a bilinear interpolation between the Z values of the 4 corners. (TLC is short for Top Left Corner, and so on). It works with rotated things as well, but the code is simplified since I'm abusing the fact everything is parallel to the X and Y axes.
Even if you rotate an object sprite_width will be its width and sprite_height will be its height, so I think the issue is that you're not computing xx/yy in "rotated space". So you'd need some code along these lines:
(where "terrain" is the ID of the slope object you want to collide with, and "player" is the player object... I don't have the source code at hand right now so I've forgotten what names are actually used in the collision logic, lol)
(The way this works is, dot product basically multiplies two vectors taking their relative alignment into account, so when one vector has length 1 the dot product will 'project' the other onto its direction... so we use this property to turn the regular x/y coordinates into coordinates relative to the rotated slope.)
The other thing that might be needed here is to make sure collisions only happen when the player is over the slope object even when it's rotated, by default Game Maker will just scale up the bounding box when you rotate something (so it is a rectangle that fully encapsulates the sprite after applying rotation) so you might trigger collisions just by being near the rotated slope since you technically collide with it.
You specifically need to have the slope object's sprite use the "rectangle with rotation" collision mode (since it is a rectangle you rotate, this is the fastest option) and probably use the "precise" flag when doing the collision checks as well - I'm not 100% sure if the rotated rectangle collision mode counts as precise or imprecise but I think it's precise.