Jeff Samardzija is going back to Chicago, but will be playing for the White Sox.

The Oakland Athletics traded the pitcher to the White Sox for prospects.

In exchange, the Athletics will receive minor league pitcher Chris Bassitt, infielders Rangel Ravelo and Marcus Semien, and catcher Josh Phegley.

Samardzija was acquired at the trade deadline from the Chicago Cubs. He struggled to find wins with the Cubs, posting a 2-7 record and 2.83 ERA before his move to Oakland. With the Athletics, the 29-year-old went 5-6 with a 3.14 ERA.

The White Sox also received minor league pitcher Michael Ynoa in the deal. In A+ ball, the 22-year-old reliever went 4-2 with a 5.52 ERA.

Oakland’s return includes the White Sox’s top first base prospect in Ravelo. He split last season between designated hitter, third and first base in AA ball, batting .309 with 11 home runs.

Phegley and Semien have both appeared in games for the White Sox over the past two seasons. Semien played around the middle infield, batting .240 in his career. Phegley batted .207.

Bassitt, a starter, split time between rookie and AA. He went 3-1 with a 2.08 ERA.

Samardzija will join closer David Robertson in Chicago, who reportedly inked a four-year, $46 million deal.

This off-season, Oakland has already dealt all-stars Brandon Moss and Josh Donaldson in its rebuilding effort.