Motion tracking user-defined area in video

I am looking for a library which handles motion tracking. The user defines an area in the video which he wants to track over several seconds. A perfect example is Adobe After Effects (https://www.youtube.com/watch?v=eyWclmjr94k). I don’t care about object detection (like detecting cat, dog, faces, …) but to actually track the position, scale, rotation of a given area. Does anybody know a library which works in the browser in real-time (or close to real-time)?

I found something like https://trackingjs.com but it looks like it just does object detection or detection of feature points.