9 and 5 months later I ran into the same problem and google took me here. However after checking the docs provided by @Harry I saw it is possible. I will copy and paste the example from MDN docs (with some code styling) here:
div[data-rotate] {
width: fit-content;
transform-origin: 50% 50%;
rotate: attr(data-rotate deg, 1.5deg);
}
<div data-rotate="-3">I am rotated by -3 degrees</div>
<div data-rotate="2">And I by 2 degrees</div>
<div data-rotate>And so am I, using the fallback value of 1.5deg</div>
(Edit 5 minutes later): Here is the link MDN docs - attr