Downconverting real signal to IQ baseband Despite reading various answers on this site and on other sites I am still confused about how to convert a real-valued signal back down to its original IQ baseband values. Note I am still a beginner at this.

I have a very minimal prototype in Matlab but I'm getting stuck. I begin by generating some IQ data and modulating it onto a carrier signal, ready to be sent as a stream of real valued numbers.

% constants
f = 100; % carrier frequency
Fs=500; % sampling frequency
t=(1/Fs:1000)*T; % time domain

% generate 1000 raw I/Q values to *transmit*
I=randi([0 1],1000,1)';
Q=randi([0 1],1000,1)';

% modulate I/Q values onto a carrier wave
Iwave = I.*cos(2*pi*f*t);
Qwave = Q.*sin(2*pi*f*t);


I assume that adding the two waves together is correct (and not subtracting them like I've seen in some notations)

% add up I/Q. and transmit this stream of real-valued numbers
tx=Iwave+Qwave;


Now the receiver mixes the signals with cos and sin waves

rxI = tx .* (cos(2*pi*f*t));
rxQ = tx .* (sin(2*pi*f*t));


Below is an FFT of the received real-valued signal in black peaking at 100Hz. And the mixed I and Q signals on the receiver, peaking at 200Hz (I know the red peak is hard to see, but it's there at 200Hz). 



Now comes the tricky part. Every resource I've read mentions I should low pass filter this I and Q, and I'll be able to get back my baseband data.

cutoff=200/Fs;
order=32;

% a 32 order low-pass FIR filter with cutoff at 200Hz
filter=fir1(order,cutoff);

filtI=filter(filter,1,rxI);
filtQ=filter(filter,1,rxQ);


Here's the FFT of the I and Q signals after low-pass filtering

Now the sent and received I channel as shown below obviously look nothing alike and simply cannot be demodulated.


What am I doing wrong here?
The ideal answer would specify exactly what filter I need to get back my baseband data in Matlab. This I think is reasonable since the example I provided is ideal and simple. 

Please also correct any misunderstandings in this post aside from the obviously incorrect filter I am using.
The allowed bandwidth of the data created and used to modulate the IQ signal needs to be below the cutoff frequency of the receiver post-heterodyne low pass filter, which needs to be below the carrier frequency, which needs to be below half the HF sampling rate to avoid aliasing.

So try a lower data rate and/or a much higher frequency carrier, with a suitably corresponding higher frequency sample rate.  You can lower your data rate by using a slower changing rand statement, and filtering that to remove harmonics of the squarish pulses.