As a corollary to the excellent advice from Aaronut, there is an important rule of thumb when selecting a wine to cook with: If you wouldn't drink it, don't cook with it.
cooking.stackexchange.com/users/178/Tim Sullivan
It absolutely does matter, as all of the different varietals have their own very distinctive tastes.
However, there's not really any "correct" wine to use when you see a recipe requesting it.
Probably the most common ones (where I'm from) are Cabernet Sauvignon for red and Chardonnay for white, but those are definitely not the only kinds you can use, and it depends entirely on the recipe and your personal preferences.
If it's going into a strong/spicy sauce where the taste of the wine will be overshadowed by the other ingredients anyway, then I'll often use any inexpensive wine I have lying around.
But if it's something like a wine sauce, or a reduction, then you should essentially treat it as a wine pairing; look up what varietal pairs well with the food you're making and use that in your sauce.
cooking.stackexchange.com/users/41/Aaronut
I tend to disagree a little bit on this.
Cooking removes almost all of the subtlety from a wine, especially long cooking like in a reduction-based sauce.
I'd like to see a double-blind taste of several reduced red varietals to see if you could tell much of a difference.
cooking.stackexchange.com/users/1393/Michael Natkin
Yes.
If you wouldn't drink it, don't cook with it.
Whatever it tastes like out of the bottle, it will add that to the dish.
Cook with a wine you might pair with the dish (light wines for seafood, chicken; heavier wines for meats and stews).
Don't use a fruity wine unless you want your dish to have some fruit notes.
Don't use a very dry wine if you're making a sweeter dish.
cooking.stackexchange.com/users/1443/Ocaasi
Avoid excessive oakiness.
Other than that, find a decent, cheap somewhat drinkable blend (one white, one red), and buy a couple 1.5 litre bottles of each.
and keep them on hand for cooking.
I'm wiki-ing this answer
so feel free to add any brands you've found good for this purpose.
cooking.stackexchange.com/users/1148/Chris Cudmore
Yes, use wine that you would happily drink.
But there's usually no need to empty a bottle of fine Barolo, or Gevrey Chambertin, into the pan.
A good young red wine is usually good enough and all the wines you use should be bought for drinking, rather than for cooking.
What wine colour you use should tip you off about the wine colour to serve with it, so helpfully you have whats left in the bottle after culinary use, to drink while cooking or afterwards.
cooking.stackexchange.com/users/21235/Bill Simpson
I am not a wine connoisseur.
I actively dislike most red wines; I'm not a fan of tannins.
So if a recipe calls for red wine as an important ingredient (Beef Bourguignon, for example), I simply won't make the recipe.
Sometimes though, like in a risotto or a Chinese sauce, a bit of wine is a lovely touch.
Sauvignon Blanc is a common white wine for cooking, but unless I use the whole bottle in the recipe, I end up throwing most of it away.
Even vacuum sealed, non-fortified wines have a short life-span once opened.
So, I keep two fortified wines in my fridge.
They serve me well
, I never find the need to buy any wines other than Dry Sherry and Dry Vermouth.
If a recipe called for it, I might buy a Marsala.
In the fridge, fortified wines like these last for months after being opened.
For what it's worth, Gallo topped America's Test Kitchen taste testing of Dry Vermouth.
cooking.stackexchange.com/users/20183/Jolenealaska
In other words does it make a difference in the event that a recipe calls for a Red wine you use a Merlot, Cabernet, Shiraz ect..?
When a recipe calls for Wine, does it make a difference what wine to use?
cooking.stackexchange.com
<wine>
cooking.stackexchange.com/questions/3185
cooking.stackexchange.com/users/177/AttilaNYC
Select a wine that is relatively cheap but one you would be happy to drink. Cooking removes subtlety from a wine, but the variety of wine does matter and should be selected based on your own tastes. While cooking a wine removes a lot of its flavours, you should choose a wine that it good enough to drink.
Only cook with a wine that you would drink. Different wines will give different taste profiles.  Cooking a wine removes a lot of the flavour so it doesn't really matter which wine you choose.