In a saucepan over high heat, soften the onions in the butter for 10 minutes. Add the sugar and vinegar. Cook for 10 minutes while stirring. Add the wine and cook over very low heat, stirring occasionally, until all the liquid has evaporated, about 1 hour 15 minutes. Season with salt and pepper.