To replace rotten window trim, remove the trim and its securing nails from the window, cut a new trim to four pieces according to the dimensions of the window, nail them in place of the old ones, and caulk the new trim. Paint the trim to create color uniformity.
Start by loosening one of the trim pieces off the nails by prying it with a crowbar or tapping it with a hammer. Once loose, pull it away from the window using your hands, and drive out the attaching nails from the window frame. Repeat the process for the remaining trim pieces.
Once the trim is off, cut a piece from the new trim that fits the measurement across the window's bottom with a miter saw, and secure the piece in place with nails. For maximum security, hammer the nails at a spacing interval of 16 inches or less. Repeat the process for the remaining trim pieces, taking care to cut the trim pieces to proper lengths and to nail the side pieces before nailing the top piece. Finally, apply an exterior caulking along the inside edge of the new trim, and repeat the process for the outside edge, taking care to seal any cracks and loose joints.