How do I change which side a shape made with the ::after pseudo class appears on the main shape?

So I made a rectangle out of a div element with css rules and I made an after psuedo class for it that is a triangle, it worked but the triangle appears attached to the bottom of the rectangle. I know that the transform property lets me rotate the triangle to the orientation I want but how do I move the triangle to stick to a different side of the rectangle?

Will post the exact code if needed.

Position relative on the div, position absolute on the ::after, then you can use top/right/bottom/left properties on it.