Keep throwing an error when the template width and height are invalid.

Also add a test to ensure that not setting them is OK too.