Commerce requires each unique product to be, well, a unique product. With its own name, sku, price, stock, etc. So if you have a flexible product in different sizes, Commerce needs to have a unique product for each of those options.
Depending on the type of product you're building, and the different sizes you offer, that could be a ton of products, in which case it would be better to create a custom add to cart snippet that takes in the width and height, does a calculation for the price, and dynamically creates (and checks for existing products) the Commerce product record. That way you don't have to manually create all unique products up-front.
Keep in mind that the way products are represented in Commerce don't necessarily have to match your front-end catalog.
For some types of products that consist of different parts (e.g., a car for which you can select the color, type of engine, and extra options), it could also be really interesting to build a configurator that results in a bundle product being created that lists each option with its own price. I'm actually working on a client project for something just like that, and have been given permission to share some of that when the project is over so will have more to share about that in the future