After marioquark’s code is written you can resize and move the template instance around with the system.gui.moveComponent and system.gui.resizeComponent functions.
I have only a small addition. If you want to use the dynamics within the template (animations, bindings, …) template should be initialized with one extra line:
I needed set a variable in my dynamically added template and it did not work. I try simple animation using through tag and it did not work. I realized that some init is missing. So because of poor programmer manual in Ignition I tried to find a solution myself (through class analyzing). Then I remembered that I saw the init function list in trace log when error occurred. And indeed there was “VisionTemplate.initialize” line