<!DOCTYPE html>
<html lang="en">
<body>
<div style="height: 20vh; width: 40vw; clip-path: polygon(0 10vh, 40vw 0, 40vw 10vh, 0 20vh); background-color: green;">
<span style="position: absolute; top: 5vh; left: 20vw; display: block; font-size: 50px; writing-mode: tb-rl; overflow: hidden; background-color: red; transform: rotate3d(0.55, 0, 1, -108deg);">text</span>
</div>
</body>
</html>
let rect = document.getElementById('parent').getBoundingClientRect();
let angle = Math.atan(rect.height/2 / rect.width);
document.getElementById('child').style.transform = `skewY(-${angle}rad)`;