Yup, you're correct that TeX can't really handle arbitrary page sizes; see my reply [0] to a sibling comment.
[0]: https://news.ycombinator.com/item?id=48487199