Preheat the oven to 350 degrees F (175 degrees C). Grease 15 individual muffin cups or line cups with paper liners.
Combine flour, sugar, cocoa powder, baking soda, and salt in a large bowl. Pour in water, oil, vanilla extract, and vinegar. Mix well into a smooth batter. Spoon batter into the prepared muffin cups, filling each 2/3 full.
Bake in the preheated oven until tops spring back when lightly pressed, 20 to 30 minutes. Cool in the muffin cups for 5 minutes. Transfer to a wire rack and let cool, about 20 minutes.
Cream margarine in a bowl with an electric mixer until soft and fluffy, about 1 minute. Add 1/2 of the confectioners' sugar, 1 tablespoon at a time, while electric mixture is running on low speed. Beat in vanilla soy milk and 1/2 teaspoon vanilla extract. Beat in remaining confectioners' sugar until frosting has desired consistency.
Spoon frosting into a piping bag and pipe over cupcakes. Decorate with sprinkles.