Cut the ends off the tomatoes and cut into quarters.
Place in a food processor or blender and process until it forms a pulp.
Heat olive oil in a large heavy-based saucepan and fry the onions and garlic over medium heat until the onion is translucent.
Add the tomato pulp and bring to a slow simmer.
Add the sugar, basil, chilli and salt and pepper.
Add the red wine if you are using it. If you prefer not to add wine you can add a similar quantity of low sodium stock or just water.
Let the sauce simmer on low for about 20 minutes stirring every few minutes. The sauce should reduce by about half.
Taste the sauce when it has reached the consistency you prefer (eg quite liquid for pasta sauce or thicker for pizza base). Adjust the seasoning if necessary (tinned tomatoes are sometimes more tart than fresh tomatoes).
Serve warm over cooked pasta or reserve for use in other recipes.