We derive from first principles, using nonequilibrium field theory, the quantum Boltzmann equations that describe the dynamics of flavor oscillations, collisions, and a time-dependent mass matrix in the early universe. Working to leading nontrivial order in ratios of relevant time scales, we study in detail a toy model for weak-scale baryogenesis: two scalar species that mix through a slowly varying time-dependent and CP-violating mass matrix, and interact with a thermal bath. This model clearly illustrates how the CP asymmetry arises through coherent flavor oscillations in a nontrivial background. We solve the Boltzmann equations numerically for the density matrices, investigating the impact of collisions in various regimes.